﻿CREATE TABLE [v1].[Unit] (
    [UnitUId]                 INT            DEFAULT ((-1)) NOT NULL,
    [UnitId]                  INT            DEFAULT ((-1)) NOT NULL,
    [UnitCode]                NVARCHAR (50)  DEFAULT ('UNK') NULL,
    [UnitType]                NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [UnitName]                NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [UnitOrderBy]             INT            DEFAULT ((2147483647)) NOT NULL,
    [UnitStartDate]           DATETIME       DEFAULT ('19000101') NOT NULL,
    [UnitEndDate]             DATETIME       DEFAULT ('99991231') NOT NULL,
    [IsLatest]                BIT            DEFAULT ((1)) NOT NULL,
    [IsDeleted]               BIT            DEFAULT ((0)) NOT NULL,
    [CompanyUId]              INT            DEFAULT ((-1)) NULL,
    [CompanyId]               INT            DEFAULT ((-1)) NULL,
    [CompanyCode]             NVARCHAR (50)  DEFAULT ('UNK') NULL,
    [CompanyName]             NVARCHAR (100) DEFAULT ('Unknown') NULL,
    [CompanyOrderBy]          INT            DEFAULT ((2147483647)) NULL,
    [DivisionUId]             INT            NULL,
    [DivisionId]              INT            NULL,
    [DivisionCode]            NVARCHAR (50)  NULL,
    [DivisionName]            NVARCHAR (100) NULL,
    [DivisionOrderBy]         INT            DEFAULT ((2147483647)) NULL,
    [BusinessUId]             INT            NULL,
    [BusinessId]              INT            NULL,
    [BusinessCode]            NVARCHAR (50)  NULL,
    [BusinessName]            NVARCHAR (100) NULL,
    [BusinessOrderBy]         INT            DEFAULT ((2147483647)) NULL,
    [DepartmentUId]           INT            NULL,
    [DepartmentId]            INT            NULL,
    [DepartmentCode]          NVARCHAR (50)  NULL,
    [DepartmentName]          NVARCHAR (100) NULL,
    [DepartmentOrderBy]       INT            DEFAULT ((2147483647)) NULL,
    [CostCentreUId]           INT            NULL,
    [CostCentreId]            INT            NULL,
    [CostCentreCode]          NVARCHAR (50)  NULL,
    [CostCentreName]          NVARCHAR (100) NULL,
    [CostCentreOrderBy]       INT            DEFAULT ((2147483647)) NULL,
    [PortfolioUId]            INT            NULL,
    [PortfolioId]             INT            NULL,
    [PortfolioCode]           NVARCHAR (50)  NULL,
    [PortfolioName]           NVARCHAR (100) NULL,
    [PortfolioOrderBy]        INT            DEFAULT ((2147483647)) NULL,
    [DeskUId]                 INT            NULL,
    [DeskId]                  INT            NULL,
    [DeskCode]                NVARCHAR (50)  NULL,
    [DeskName]                NVARCHAR (100) NULL,
    [DeskOrderBy]             INT            DEFAULT ((2147483647)) NULL,
    [BookUId]                 INT            NULL,
    [BookId]                  INT            NULL,
    [BookCode]                NVARCHAR (50)  NULL,
    [BookName]                NVARCHAR (100) NULL,
    [BookOrderBy]             INT            DEFAULT ((2147483647)) NULL,
    [ProgrammeUId]            INT            NULL,
    [ProgrammeId]             INT            NULL,
    [ProgrammeCode]           NVARCHAR (50)  NULL,
    [ProgrammeName]           NVARCHAR (100) NULL,
    [ProgrammeOrderBy]        INT            DEFAULT ((2147483647)) NULL,
    [ProjectUId]              INT            NULL,
    [ProjectId]               INT            NULL,
    [ProjectCode]             NVARCHAR (50)  NULL,
    [ProjectName]             NVARCHAR (100) NULL,
    [ProjectOrderBy]          INT            DEFAULT ((2147483647)) NULL,
    [EmployeeUId]             INT            NULL,
    [EmployeeId]              INT            NULL,
    [EmployeeCode]            NVARCHAR (50)  NULL,
    [EmployeeName]            NVARCHAR (100) NULL,
    [EmployeeOrderBy]         INT            DEFAULT ((2147483647)) NULL,
    [PnLPackageUId]           INT            NULL,
    [PnLPackageId]            INT            NULL,
    [PnLPackageCode]          NVARCHAR (50)  NULL,
    [PnLPackageName]          NVARCHAR (100) NULL,
    [PnLPackageOrderBy]       INT            DEFAULT ((2147483647)) NULL,
    [ProjectClassificationId] INT            NULL,
    [ProjectClassification]   NVARCHAR (100) NULL,
    [ProjectTreatmentId]      INT            NULL,
    [ProjectTreatment]        NVARCHAR (100) NULL,
    [ProjectSystemId]         INT            NULL,
    [ProjectSystem]           NVARCHAR (100) NULL,
    [RowChecksumMD5]          CHAR (36)      DEFAULT ('') NULL,
    [RowAuditId]              INT            DEFAULT ((-1)) NOT NULL
);

